{% extends "base.html" %} {% load staticfiles %}
{% block title %} 用户信息 {% endblock title %}
{% block content %}
<div class="container">
    <div class="row">
        <div class="col-12">
            <br>
            <div class="col-md-4">用户名: {{ user.username }}</div>
            <br>
            {% if profile.avatar %}
                <div class="col-md-4">头像</div>
                <img src="{{ profile.avatar.url }}" style="max-width: 20%; border-radius: 15%;" class="col-md-4">
            {% else %}
                <h5 class="col-md-4">暂无头像</h5>
            {% endif %}
            <br>
            <form method="post" action="." enctype="multipart/form-data">
                {% csrf_token %}
                <!-- avatar -->
                <div class="form-group col-md-4">
                    <label for="avatar">上传头像</label>
                    <input type="file" class="form-control-file" name="avatar" id="avatar">
                </div>

                <!-- phone -->
                <div class="form-group col-md-4">
                    <label for="phone">电话</label>
                    <input type="text" class="form-control" id="phone" name="phone" value="{{ profile.phone }}">
                </div>
                <!-- bio -->
                <div class="form-group col-md-4">
                    <label for="bio">简介</label>
                    <!-- 文本区域 -->
                    <textarea type="text" class="form-control" id="bio" name="bio" rows="12">{{ profile.bio }}</textarea>
                </div>
                <!-- 提交按钮 -->
                <button type="submit" class="btn btn-primary">提交</button>
            </form>
        </div>
    </div>
</div>
{% endblock content %}